#ifndef VSCLOBJECT_H
#define VSCLOBJECT_H
#include "VSObject.h"
#include "VSController.h"
namespace VSEngine2
{

	class VSController;
	class VSStream;
	class VSGRAPHIC_API VSCLObject : public VSObject
	{
		//RTTI
		DECLARE_RTTI;	
		DECLARE_INITIAL_NO_CLASS_FACTORY;
	public:
		VSArray<VSControllerPtr>	m_ControllerArray;
		inline unsigned int GetControllerNum()const {return m_ControllerArray.GetNum();}
		virtual void UpdateController(double dAppTime);
		bool AddController(VSController * pController);
		VSController * DeleteController(unsigned int ID);
		unsigned int DeleteController(VSController *pController);
		VSController *GetController(unsigned int ID)const;
		void DeleteAllController();
		inline VSArray<VSPointer<VSController>> * GetControllerList();
	public:
		virtual ~VSCLObject() = 0;
		inline void SetDynamic(bool bIsDynamic);
		inline bool IsDynamic()const {return !m_bIsStatic;}
		void ClearAllTime();
	protected:
		VSCLObject();
		bool m_bIsStatic;
		bool m_bIsChanged;
	public:
		virtual bool Register(VSStream & rStream)const;

		virtual unsigned int DiskUse()const;
		virtual bool Save(VSStream & rStream,unsigned int &iSaveUse)const;
		virtual bool Load(VSStream & rStream,unsigned int &iSaveUse);
		virtual bool Link(VSStream & rStream);
		//Clone
	public:
		virtual bool Clone(const VSObject *pObject,unsigned int uiType);
	public:
		bool m_bEnable;
	};
	#include "VSCLObject.inl"
	DECLARE_Ptr(VSCLObject);
	VSTYPE_MARCO(VSCLObject);
}
#endif